//
//  T4_5_CCell.swift
//  Pods
//
//  Created by eme on 2017/4/10.
//
//

/*
 owner:cy
 update:2017年04月17日10:48:45
 info: 商品类->小图单例 cell
 VC :  HomePageVc
 */
import UIKit
import RxSwift
import RickonCore
import BrandonCore

class T4_5_CCell: UICollectionViewCell {
    
    //商品名称
    @IBOutlet weak var pddes_Lb: UILabel!
    
    //商品名称
    @IBOutlet weak var pdname_Lb: UILabel!
    
    //品牌名称
    @IBOutlet weak var brname_Lb: UILabel!
    
    //店铺进货价
    @IBOutlet weak var shprice_Lb: UILabel!
    
    @IBOutlet weak var jinPriceImg_V: UIImageView!
    
    @IBOutlet weak var img1_ImgV: UIImageView!
    
    @IBOutlet weak var collectionState_ImgV: UIImageView!
    /// 显示已售罄
    @IBOutlet weak var sellOut_ImgV: UIImageView!
    
    @IBOutlet weak var separate_V: UIView!
    var item :T4ListModel?{
        didSet{
            if let item = self.item {
                self.pddes_Lb.text = item.pddes
                self.pdname_Lb.text = item.pdname
                self.brname_Lb.text = item.brname
                self.img1_ImgV.setUrlImage(item.img1)
                self.jinPriceImg_V.image = UIImage(named: AppData.getPriceImgName(), in: RobbCore.bundle, compatibleWith: nil)
                self.shprice_Lb.text = AppData.getFinalShowPrice(jinPrice: item.minagprice, lingPrice: item.bdprice).getPriceStr()
                self.collectionState_ImgV.image = UIImage(named: item.iscol == 1 ?"product-collectioned":"product-uncollectioned", in: RobbCore.bundle, compatibleWith: nil)
               
                if item.stock == 0 || item.pdstate != "3" {
                    self.sellOut_ImgV.isHidden = false
                     self.sellOut_ImgV.image = UIImage(named: item.stock == 0 ?"sellout":"failure", in: RobbCore.bundle, compatibleWith: nil)
                    
                }else{
                    self.sellOut_ImgV.isHidden = true
                }
            }
        }
    }
    override func awakeFromNib() {
        self.separate_V.backgroundColor = Theme.v.separate_Line
        self.pddes_Lb.bold_fontSize(13)
        self.pdname_Lb.normal_fontSize(13)
        self.brname_Lb.normal_fontSize(12)
        self.shprice_Lb.bold_fontSize(13)
    }
    
}
